package evaluation;

import course.Course;

public class CourseEvaluation extends Evaluation {
	
	private Course course;
	
	public CourseEvaluation(Course course, int points) {
		this.course = course;
		setPoints(points);
	}
	
	public Course getCourse() {
		return course;
	}

	@Override
	public String getGrade() {
		String grade;
		if(getPoints() > 90) {
			grade = "Sehr Gut";
		} else if(getPoints() > 77) {
			grade = "Gut";
		} else if(getPoints() > 65) {
			grade = "Befriedigend";
		} else if(getPoints() > 50) {
			grade = "Genuegend";
		} else {
			grade = "Nicht Genuegend";
		}
		return grade;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((course == null) ? 0 : course.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		CourseEvaluation other = (CourseEvaluation) obj;
		if (course == null) {
			if (other.course != null) {
				return false;
			}
		} else if (!course.equals(other.course)) {
			return false;
		}
		return true;
	}
}
